home *** CD-ROM | disk | FTP | other *** search
/ Delphi Magazine Collection 2001 / Delphi Magazine Collection 20001 (2001).iso / DISKS / Issue60 / COMThrd / MultipleSTAServer_TLB.pas < prev    next >
Encoding:
Pascal/Delphi Source File  |  2000-06-02  |  4.8 KB  |  108 lines

  1. unit MultipleSTAServer_TLB;
  2.  
  3. // ************************************************************************ //
  4. // WARNING                                                                    
  5. // -------                                                                    
  6. // The types declared in this file were generated from data read from a       
  7. // Type Library. If this type library is explicitly or indirectly (via        
  8. // another type library referring to this type library) re-imported, or the   
  9. // 'Refresh' command of the Type Library Editor activated while editing the   
  10. // Type Library, the contents of this file will be regenerated and all        
  11. // manual modifications will be lost.                                         
  12. // ************************************************************************ //
  13.  
  14. // PASTLWTR : $Revision:   1.88.1.0.1.0  $
  15. // File generated on 02/06/2000 17:19:51 from Type Library described below.
  16.  
  17. // ************************************************************************ //
  18. // Type Lib: D:\Magazines\Work In Progress\60 - Aug 00\COM Threading\Files\MultipleSTAServer.tlb (1)
  19. // IID\LCID: {773BF93B-38A7-11D4-96EC-0060978E1359}\0
  20. // Helpfile: 
  21. // DepndLst: 
  22. //   (1) v2.0 stdole, (C:\WINDOWS\SYSTEM\STDOLE2.TLB)
  23. //   (2) v4.0 StdVCL, (C:\WINDOWS\SYSTEM\STDVCL40.DLL)
  24. // ************************************************************************ //
  25. {$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. 
  26. interface
  27.  
  28. uses Windows, ActiveX, Classes, Graphics, OleServer, OleCtrls, StdVCL;
  29.  
  30. // *********************************************************************//
  31. // GUIDS declared in the TypeLibrary. Following prefixes are used:        
  32. //   Type Libraries     : LIBID_xxxx                                      
  33. //   CoClasses          : CLASS_xxxx                                      
  34. //   DISPInterfaces     : DIID_xxxx                                       
  35. //   Non-DISP interfaces: IID_xxxx                                        
  36. // *********************************************************************//
  37. const
  38.   // TypeLibrary Major and minor versions
  39.   MultipleSTAServerMajorVersion = 1;
  40.   MultipleSTAServerMinorVersion = 0;
  41.  
  42.   LIBID_MultipleSTAServer: TGUID = '{773BF93B-38A7-11D4-96EC-0060978E1359}';
  43.  
  44.   IID_ISTAObject: TGUID = '{773BF940-38A7-11D4-96EC-0060978E1359}';
  45.   CLASS_STAObject: TGUID = '{773BF942-38A7-11D4-96EC-0060978E1359}';
  46. type
  47.  
  48. // *********************************************************************//
  49. // Forward declaration of types defined in TypeLibrary                    
  50. // *********************************************************************//
  51.   ISTAObject = interface;
  52.   ISTAObjectDisp = dispinterface;
  53.  
  54. // *********************************************************************//
  55. // Declaration of CoClasses defined in Type Library                       
  56. // (NOTE: Here we map each CoClass to its Default Interface)              
  57. // *********************************************************************//
  58.   STAObject = ISTAObject;
  59.  
  60.  
  61. // *********************************************************************//
  62. // Interface: ISTAObject
  63. // Flags:     (320) Dual OleAutomation
  64. // GUID:      {773BF940-38A7-11D4-96EC-0060978E1359}
  65. // *********************************************************************//
  66.   ISTAObject = interface(IUnknown)
  67.     ['{773BF940-38A7-11D4-96EC-0060978E1359}']
  68.     procedure Foo; safecall;
  69.   end;
  70.  
  71. // *********************************************************************//
  72. // DispIntf:  ISTAObjectDisp
  73. // Flags:     (320) Dual OleAutomation
  74. // GUID:      {773BF940-38A7-11D4-96EC-0060978E1359}
  75. // *********************************************************************//
  76.   ISTAObjectDisp = dispinterface
  77.     ['{773BF940-38A7-11D4-96EC-0060978E1359}']
  78.     procedure Foo; dispid 1;
  79.   end;
  80.  
  81. // *********************************************************************//
  82. // The Class CoSTAObject provides a Create and CreateRemote method to          
  83. // create instances of the default interface ISTAObject exposed by              
  84. // the CoClass STAObject. The functions are intended to be used by             
  85. // clients wishing to automate the CoClass objects exposed by the         
  86. // server of this typelibrary.                                            
  87. // *********************************************************************//
  88.   CoSTAObject = class
  89.     class function Create: ISTAObject;
  90.     class function CreateRemote(const MachineName: string): ISTAObject;
  91.   end;
  92.  
  93. implementation
  94.  
  95. uses ComObj;
  96.  
  97. class function CoSTAObject.Create: ISTAObject;
  98. begin
  99.   Result := CreateComObject(CLASS_STAObject) as ISTAObject;
  100. end;
  101.  
  102. class function CoSTAObject.CreateRemote(const MachineName: string): ISTAObject;
  103. begin
  104.   Result := CreateRemoteComObject(MachineName, CLASS_STAObject) as ISTAObject;
  105. end;
  106.  
  107. end.
  108.